<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{Title} (Add) </title>
<link rel="stylesheet" href="../../css/mem_main.css" type="text/css">
<script Language="JavaScript1.2" type="text/javascript" src="/inc/checkdata_{intLang}.js"></script>
<script Language="JavaScript">
<!--
function finalcheck(){
	with(document.beMemberFrm){
		if(Check(document.beMemberFrm)){
			submit();
		}
	}
}

var xmlHttp;
function createXMLHttpRequest(){
	if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		xmlHttp = null;
	}
}

function getHostInfo(){
	var strHostName = document.beMemberFrm["HostName"].value;
	var strDocLoc = "index.php?op=SearchUsedDaomin&HostName="+strHostName;

	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.open("GET", strDocLoc, true);
	xmlHttp.send(null);
}

function handleStateChange(){
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			var xmlDoc = xmlHttp.responseXML;

			var strResult = xmlDoc.getElementsByTagName("Result")[0].childNodes[0].nodeValue;
			switch(strResult){
				case "Error":
					alert(xmlDoc.getElementsByTagName("Message")[0].childNodes[0].nodeValue);
					break;
				
				case "isUsed":
					alert("{HostNameExist}");
					document.beMemberFrm["HostName"].select();
					break;

				default:
					alert("{HostNameNotUsed}");
					break;
			}
		}
	}
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">

<!-- 檢驗資料用 //-->
<form name="CheckDataForm">
	<input type="hidden" name="required" value="text;HostName;{HostName}">
	<input type="hidden" name="required" value="text;HostName;{HostName}">
</form>
<!-- End //-->

<form name="beMemberFrm" method="GET" action="index.php">
<input type="hidden" name="op" value="Insert">
<table width="770" border="0" cellspacing="0" cellpadding="0" class="cmti">
  <tr> 
    <td>{Title}: {Add} -- 
      <input type="button" value="{Add}" class="zabutton" onClick="location.href='index.php?op=Add'">
      <input type="button" value="{List}" class="zabutton" onClick="location.href='index.php?op=Lists'">
      <input type="button" value="{Search}" class="zabutton" onClick="location.href='index.php?op=Search'">
    </td>
  </tr>
</table>
<div class="ctabdv"> 
  <table width="500" border="0" cellspacing="1" cellpadding="0" class="ctab">
    <tr class="clef"> 
      <td class="ctigaed">{HostName}</td>
      <td> 
        <input type="text" name="HostName" size="20" class="zatexted" value="">
        <input type="button" value="{SearchHost}" class="zabutton" onclick="getHostInfo()">
      </td>
    </tr>
    <tr class="clef"> 
      <td class="ctigaed">{Director}</td>
      <td>{DirectorCheckBox}</td>
    </tr>
    <tr class="clef"> 
      <td class="ctigaed">{Memo}</td>
      <td><input type="text" name="Memo" size="60" class="zatexted" value=""></td>
    </tr>
    <tr class="clef"> 
      <td colspan="2" class="cedfoot"> 
        <input type="button" value="{Add}" class="zabutton" onclick="finalcheck()">&nbsp;&nbsp;&nbsp; 
        <input type="reset" value="{Reset}" class="zabutton">
      </td>
    </tr>
  </table>
</div>
</form>
</body>
</html>
